package acwing;

import java.io.*;
import java.util.*;

public class ac3792 {
    static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader bin = new BufferedReader(new InputStreamReader(System.in));
    static final int N = 1010;
    static int n, k, cnt, T;
    static boolean[] st = new boolean[N];
    static int[] primes = new int[N];

    static int cin() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }

    static void get_prime(int n) {
        for (int i = 2; i <= n; i ++ ) {
            if (!st[i]) primes[cnt ++ ] = i;
            for (int j = 0; primes[j] * i <= n; j ++ ) {
                st[primes[j] * i] = true;
                if (i % primes[j] == 0) break;
            }
        }
    }

    public static void main(String[] args) throws IOException {
        T = cin();
        get_prime(N - 1);

        while (T -- > 0) {
            n = cin(); k = cin();
            int res = 0;
            for (int i = 2; i <= n; i ++ ) {
                if (!st[i]) continue;
                for (int j = 1; j < cnt; j ++ ) {
                    if (primes[j - 1] + primes[j] + 1 == i) {
                        res ++ ;
                        break;
                    }
                }
            }
            if (res >= k) out.println("YES");
            else out.println("NO");
//            out.println(res);
        }
        out.close();
    }
}